package com.ccz.demo.design.proxy.demo1.cglibproxy;

import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

/**
 * @ClassName cgLibDynProxyLawyer
 * @Author caihaoyun
 * @Date 2020/4/13
 * @Version V1.0
 **/
public class cgLibDynProxyLawyer implements MethodInterceptor {

    @Override
    public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
        if (method.getName().equals("submit")) {
            System.out.println("提交方法成功");
        }
        Object o1 = methodProxy.invokeSuper(o, objects);
        return o1;
    }
}